<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="issuedfileaction.DBConnection;"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>       
    <title>查询经销商</title>    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>  
  <body> 
  <%
    String begintime="";
    String endtime="";
    String customercode="";
    String filetype="";
     try{
         begintime=new String(request.getParameter("begintime").getBytes("ISO-8859-1"),"gbk");
     }catch(Exception e){
         begintime="";
     }
     try{
         endtime=new String(request.getParameter("endtime").getBytes("ISO-8859-1"),"gbk");
     }catch(Exception e){
         endtime="";
     }
     try{
         customercode=new String(request.getParameter("customercode").getBytes("ISO-8859-1"),"gbk");
     }catch(Exception e){
         customercode="";
     }
     try{
         filetype=new String(request.getParameter("filetype").getBytes("ISO-8859-1"),"gbk");
     }catch(Exception e){
         filetype="";
     }  
     String StrSQL="select dt_udatetime,dt_uoccurdatetime,dt_udealercode,dt_udealername,dt_uquestion,dt_uresult,dt_urecord,dt_utype,'a' from dturgerecord where 1=1 ";  
     if(!customercode.equals("")){
         StrSQL=StrSQL+" and dt_udealercode='"+customercode.trim()+"'";
     }     
     if(filetype.equals("day")){
        StrSQL=StrSQL+" and dt_utype like '%D%'";
     }else if(filetype.equals("month")){
        StrSQL=StrSQL+" and dt_utype like '%M%'";
     } 
     StrSQL=StrSQL+" and (to_date(to_char(dt_udatetime,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')>=to_date('"+begintime+"','YYYY-MM-DD HH24:MI:SS') "; 
     StrSQL=StrSQL+" and  to_date(to_char(dt_udatetime,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')<=to_date('"+endtime+"','YYYY-MM-DD HH24:MI:SS')) ";
     List<Object> UrgeListRows=new ArrayList<Object>();
     DBConnection db=new DBConnection();
     UrgeListRows=db.SQLUrgeListExec(StrSQL); 
	 HttpSession httpSession = request.getSession();         
     httpSession.setAttribute("UrgeListRows", UrgeListRows);	
     httpSession.setAttribute("UrgeBeginTime",begintime);
     httpSession.setAttribute("UrgeEndTime",endtime);
     httpSession.setAttribute("UrgeCustomercode",customercode);
     httpSession.setAttribute("UrgeType",filetype);    
     httpSession.setAttribute("UrgeStrSQL",StrSQL);          		    	  
	 response.sendRedirect("UrgeInfoQuery.jsp");                         
  %>
  </body>
</html>
